Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Iowar/improve.0 #20

Merged
merged 8 commits into from
Oct 2, 2023
Merged

Iowar/improve.0 #20

merged 8 commits into from
Oct 2, 2023

Conversation

iowar
Copy link
Collaborator

@iowar iowar commented Sep 30, 2023

connection gater activated, when register is activated, potential s<>s connections will be rejected directly

@@ -101,6 +104,13 @@ func New(opts *Options) (*Service, error) {
return nil, err
}

for _, addr := range host.Addrs() {
opts.Logger.With(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger.With is used to create a new logger with persistent fields. If you just want to add key-values to the log, the correct way is to add them as part of arguments.

opts.Logger.Info("p2p address", "addr", addr, "host_address", host.ID().Pretty())

@@ -96,6 +96,8 @@ func (t *topology) Disconnected(p p2p.Peer) {
t.mu.Lock()
defer t.mu.Unlock()

t.logger.With("peer", p).Info("disconnected")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Contributor

@aloknerurkar aloknerurkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for now. What I would also do is add the logger to this and log the blocking events. You can do that along with the blocklisting changes.

@iowar iowar merged commit ae57486 into main Oct 2, 2023
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants